package com.question.java.string;

/**
 * @Description:
 * @Author: Jun Yang
 * @Time: 2018/9/12 下午9:04
 * @Version: 1.0
 */
public class TestStringMain {
    public static void main(String[] args) {
        String s1 = "abc";
        String s2 = "abc"; //字节码常量
        String s3 = new String("abc");
        String s4 = new String("abc");

        System.out.println("s1==s2: " + (s1 == s2));

        System.out.println("s1==s3: " + (s1 == s3));

        System.out.println("s3==s4: " + (s3 == s4));

        //s3.intern() 运行时常量
        System.out.println("s1==s3.intern(): " + (s1 == s3.intern()));
    }
}
